﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:acl="clr-namespace:AC.AvalonControlsLibrary.Controls;assembly=t01crm.Controls" 
    xmlns:biz="clr-namespace:t01crm.Business;assembly=t01crm.Business"
	xmlns:acl2="AC"
	mc:Ignorable="d"
	x:Class="t01crm.View.PreferencesEditor"
	x:Name="UserControl"
 
	d:DesignWidth="408" d:DesignHeight="328" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" Height="320">
    <UserControl.Resources>
        <ItemsPanelTemplate x:Key="WrapPanelTemplate">
            <WrapPanel IsItemsHost="True"/>
        </ItemsPanelTemplate>
        <DataTemplate x:Key="CheckboxDataTemplate">
            <CheckBox Content="{Binding}" Margin="5,0,0,5" />
        </DataTemplate>
        <Style x:Key="RangeSliderStyle1" TargetType="{x:Type acl:RangeSlider}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type acl:RangeSlider}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <StackPanel x:Name="PART_RangeSliderContainer" Orientation="Horizontal" 
							Height="{TemplateBinding Height}" >
                                <RepeatButton x:Name="PART_LeftEdge" Style="{DynamicResource RepeatButtonStyle1}"/>
                                <Thumb Cursor="SizeWE" x:Name="PART_LeftThumb" Style="{DynamicResource ThumbStyle1}"/>
                                <Thumb Cursor="ScrollAll" MinWidth="10" x:Name="PART_MiddleThumb" Background="Green"/>
                                <Thumb Cursor="SizeWE" x:Name="PART_RightThumb" Style="{DynamicResource ThumbStyle1}"/>
                                <RepeatButton x:Name="PART_RightEdge" Style="{DynamicResource RepeatButtonStyle1}" />
                            </StackPanel>

                            <TextBlock x:Name="PART_StartText" Grid.Row="1" HorizontalAlignment="Left" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=RangeStartSelected, Mode=TwoWay}" />
                            <TextBlock x:Name="PART_StopText" Grid.Row="1" HorizontalAlignment="Right" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=RangeStopSelected, Mode=TwoWay}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ThumbStyle1" TargetType="{x:Type Thumb}">
            <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Grid Background="#00000000">
                                <Path Stretch="Fill" Stroke="#FF000000"  VerticalAlignment="Stretch" Data="M-1.0486111,10.430898 L9.5121528,10.430897 3.375,19.79 z" Margin="0,0,0,0" Fill="#FFF30B0B"/>
                                <!-- <Border Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" BorderThickness="0,0,1,1"/>
								<Border Margin="1" Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" BorderThickness="0,0,1,1"/>
								<Border Margin="2" Background="{TemplateBinding Background}"/> -->

                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ButtonFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
            <GradientStop Color="#F3F3F3" Offset="0"/>
            <GradientStop Color="#EBEBEB" Offset="0.5"/>
            <GradientStop Color="#DDDDDD" Offset="0.5"/>
            <GradientStop Color="#CDCDCD" Offset="1"/>
        </LinearGradientBrush>
        <SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
        <Style x:Key="BaseButtonStyle" TargetType="{x:Type ButtonBase}">
            <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
            <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
            <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ButtonBase}">
                        <Grid Background="Transparent" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="RepeatButtonStyle1" BasedOn="{StaticResource BaseButtonStyle}" TargetType="{x:Type RepeatButton}">
            <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
        </Style>
        <Style x:Key="Heading3" TargetType="{x:Type TextBlock}">
            <Setter Property="TextWrapping" Value="NoWrap"/>
            <Setter Property="TextTrimming" Value="None"/>
            <Setter Property="Foreground" Value="#FF2564AB"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="HorizontalAlignment" Value="Left" />

        </Style>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.49*" />
            <ColumnDefinition Width="0.51*" />
        </Grid.ColumnDefinitions>
        <StackPanel Margin="0,0,0,3" Grid.ColumnSpan="2">

            <TextBlock Style="{DynamicResource Heading3}" Text="Location" Width="408" Height="15.96"  />

            <!--<Grid  Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type WrapPanel}}}" Height="Auto">-->
            <Grid  Height="Auto">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width=".2*"/>
                    <ColumnDefinition Width=".4*"/>
                    <ColumnDefinition Width=".4*"/>
                </Grid.ColumnDefinitions>
                <StackPanel  Grid.Row="1" HorizontalAlignment="Stretch" Width="Auto" Grid.Column="0"  VerticalAlignment="Bottom" Margin="0,0,10,4">
                    <TextBlock Text="State" />
                    <ComboBox x:Name="State" />
                </StackPanel>
                <StackPanel  Grid.Row="1" HorizontalAlignment="Stretch" Width="Auto" Grid.Column="1"   VerticalAlignment="Bottom" Margin="0,0,10,4">
                    <TextBlock Text="County" />
                    <ComboBox x:Name="County" />
                </StackPanel>
                <StackPanel  Margin="0,0,10,4" Grid.Row="1" Grid.Column="2"   VerticalAlignment="Bottom">
                    <TextBlock Text="Neighborhood" />
                    <ComboBox x:Name="Neighborhood" />
                </StackPanel>


            </Grid>
            <TextBlock Text="Property Types" TextWrapping="Wrap" Style="{DynamicResource Heading3}"/>

            <ItemsControl ItemsPanel="{DynamicResource WrapPanelTemplate}" 
				ItemTemplate="{DynamicResource CheckboxDataTemplate}" ItemsSource="{x:Static biz:FilterMetadata.PropertyTypes}"  />
            <TextBlock Style="{DynamicResource Heading3}" Text="Property Details" TextWrapping="Wrap" Width="408" Height="Auto"/>


            <WrapPanel>
                <StackPanel    Margin="0,0,10,0" >
                    <TextBlock Text="Price start" />
                    <ComboBox x:Name="PriceLowEnd" ItemsSource="{x:Static biz:FilterMetadata.Prices}" SelectedItem="{Binding PriceStop}"/>
                </StackPanel>

                <StackPanel    Margin="0,0,10,0">
                    <TextBlock Text="Price stop:" />
                    <ComboBox x:Name="PriceHighEnd" ItemsSource="{x:Static biz:FilterMetadata.Prices}" 
					SelectedItem="{Binding PriceStop}"/>
                </StackPanel>


                <StackPanel    Margin="0,0,10,0">
                    <TextBlock Text="Rooms:" />
                    <ComboBox x:Name="MinRooms" ItemsSource="{x:Static biz:FilterMetadata.Rooms}"
					SelectedItem="{Binding MinRooms}"/>
                </StackPanel>

                <StackPanel   Margin="0,0,10,0">
                    <TextBlock Text="Bathrooms:"   />
                    <ComboBox x:Name="MinBaths"  ItemsSource="{x:Static biz:FilterMetadata.BathRooms}" 
					SelectedItem="{Binding MinBaths}"/>
                </StackPanel>

                <StackPanel  Margin="0,0,10,0">
                    <TextBlock Text="Square Feet:"   />
                    <ComboBox x:Name="SquareFootage"  ItemsSource="{x:Static biz:FilterMetadata.SquareFootage }"
					SelectedItem="{Binding SquareFeet}"
					/>
                </StackPanel>

                <StackPanel   Margin="0,0,10,0">
                    <TextBlock Text="Acreage:"   />
                    <ComboBox x:Name="Acreage" ItemsSource="{x:Static biz:FilterMetadata.Acreage}" 
					SelectedItem="{Binding Acreage}"/>
                </StackPanel>

                <StackPanel   Height="Auto" Margin="0,0,10,0">
                    <TextBlock Text="Garage:" Grid.Row="4" />
                    <ComboBox x:Name="MinGarage" ItemsSource="{x:Static biz:FilterMetadata.Garage}" 
					SelectedItem="{Binding MinGarage}" />

                </StackPanel>
                <StackPanel    Margin="0,0,10,0">
                    <TextBlock Text="Years old:" Grid.Column="5" Grid.Row="4" />
                    <ComboBox x:Name="Yearsold" Grid.Row="5" Grid.Column="1" 
					ItemsSource="{x:Static biz:FilterMetadata.PropertyAge}" 
					SelectedItem="{Binding YearsOld}" />
                </StackPanel>
            </WrapPanel>

            <DockPanel Width="Auto"  LastChildFill="True">
                <TextBlock DockPanel.Dock="Top" Style="{DynamicResource Heading3}" Text="Extra  Features"/>
                <CheckBox x:Name="Waterfront"   Content="WaterFront" DockPanel.Dock="Bottom" 
                IsChecked="{Binding HasWaterFront}"/>
                <CheckBox x:Name="View"  Content="View" DockPanel.Dock="Bottom" IsChecked="{Binding HasView}"/>
            </DockPanel>
        </StackPanel>
    </Grid>
</UserControl>